home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr45 / mdidmo.zip / MDILOGO1.FRM < prev    next >
Text File  |  1994-04-12  |  7KB  |  245 lines

  1. VERSION 2.00
  2. Begin Form frmLogo 
  3.    BorderStyle     =   0  'None
  4.    ClientHeight    =   4200
  5.    ClientLeft      =   1155
  6.    ClientTop       =   2205
  7.    ClientWidth     =   8670
  8.    ClipControls    =   0   'False
  9.    ControlBox      =   0   'False
  10.    Height          =   4605
  11.    Left            =   1095
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   280
  17.    ScaleMode       =   3  'Pixel
  18.    ScaleWidth      =   578
  19.    Top             =   1860
  20.    Width           =   8790
  21.    Begin PictureBox Picture2 
  22.       AutoSize        =   -1  'True
  23.       Height          =   765
  24.       Left            =   4980
  25.       Picture         =   MDILOGO1.FRX:0000
  26.       ScaleHeight     =   735
  27.       ScaleWidth      =   840
  28.       TabIndex        =   3
  29.       Top             =   300
  30.       Visible         =   0   'False
  31.       Width           =   870
  32.    End
  33.    Begin PictureBox Picture1 
  34.       AutoSize        =   -1  'True
  35.       BorderStyle     =   0  'None
  36.       Height          =   810
  37.       Left            =   3600
  38.       Picture         =   MDILOGO1.FRX:0422
  39.       ScaleHeight     =   54
  40.       ScaleMode       =   3  'Pixel
  41.       ScaleWidth      =   56
  42.       TabIndex        =   2
  43.       Top             =   1230
  44.       Visible         =   0   'False
  45.       Width           =   840
  46.    End
  47.    Begin Label Label1 
  48.       AutoSize        =   -1  'True
  49.       Caption         =   "This little skull is here because the Image control won't maintain the proper palette without it.  :-("
  50.       Height          =   705
  51.       Left            =   4860
  52.       TabIndex        =   4
  53.       Top             =   1140
  54.       Visible         =   0   'False
  55.       Width           =   3090
  56.       WordWrap        =   -1  'True
  57.    End
  58.    Begin Image Image3 
  59.       Height          =   6840
  60.       Left            =   4650
  61.       Picture         =   MDILOGO1.FRX:142C
  62.       Top             =   90
  63.       Visible         =   0   'False
  64.       Width           =   6840
  65.    End
  66.    Begin Label Expl 
  67.       AutoSize        =   -1  'True
  68.       BackStyle       =   0  'Transparent
  69.       Caption         =   "Explanation"
  70.       FontBold        =   -1  'True
  71.       FontItalic      =   0   'False
  72.       FontName        =   "MS Sans Serif"
  73.       FontSize        =   12
  74.       FontStrikethru  =   0   'False
  75.       FontUnderline   =   0   'False
  76.       Height          =   300
  77.       Left            =   3450
  78.       TabIndex        =   1
  79.       Top             =   750
  80.       Width           =   1425
  81.    End
  82.    Begin Label HiddenSwitch 
  83.       Caption         =   "HiddenSwitch"
  84.       Height          =   345
  85.       Left            =   3390
  86.       TabIndex        =   0
  87.       Top             =   210
  88.       Visible         =   0   'False
  89.       Width           =   1545
  90.    End
  91.    Begin Image Image2 
  92.       Height          =   2880
  93.       Left            =   150
  94.       Picture         =   MDILOGO1.FRX:4652
  95.       Top             =   180
  96.       Visible         =   0   'False
  97.       Width           =   3075
  98.    End
  99.    Begin Image Image1 
  100.       Height          =   12480
  101.       Left            =   -300
  102.       Picture         =   MDILOGO1.FRX:8AB8
  103.       Top             =   2970
  104.       Width           =   15585
  105.    End
  106. End
  107. '---------------------------------------------------------------------------
  108. ' MDI Background Demo Program, Copyright (c) 1994 Karl E. Peterson
  109. ' Redistributed by permission.    CompuServe: 72302,3707
  110. ' See MDILOGO.BAS for complete description
  111. '---------------------------------------------------------------------------
  112.  
  113. 'Default behavior
  114.   DefInt A-Z
  115.   Option Explicit
  116.  
  117. 'Various options for background
  118.   Const bkNull = 0
  119.   Const bkStrWmf = 1
  120.   Const bkCenBmp = 2
  121.   Const bkStrBmp = 3
  122.   Const bkTilBmp = 4
  123. 'Highest numbered option
  124.   Const bkOptions = 4
  125.  
  126. Sub Form_Activate ()
  127.   'Force background to back, in case it somehow gets activated.
  128.   'This should really never occur, since it's disabled.
  129.     frmLogo.ZOrder 1
  130. End Sub
  131.  
  132. Sub Form_Load ()
  133.   'Form needs to be disabled (to prevent it from activating),
  134.   'and doesn't need AutoRedraw for BitBlt.
  135.     Me.Enabled = False
  136.     Me.AutoRedraw = False
  137.   'BitBlt requires AutoRedraw be set to True.
  138.     Picture1.AutoRedraw = True
  139.     Picture2.AutoRedraw = True
  140.   'Image control needs to be auto-sized *after* startup
  141.     Image3.Stretch = True
  142.   'Set up the explanation label
  143.     Expl.Move 10, 10
  144.   'Trigger the initial background
  145.     HiddenSwitch = 1
  146. End Sub
  147.  
  148. Sub Form_Paint ()
  149.  
  150.   Select Case Val(HiddenSwitch)
  151.     Case bkTilBmp 'do a Tiled BitBlt
  152.       TiledBitBltPictToForm Picture1, Me
  153.   End Select
  154.   
  155. End Sub
  156.  
  157. Sub Form_Resize ()
  158.   
  159.   'If a maximized form is restored, VB sends a ShowWindow to all
  160.   'children.  We need to keep the hidden ones hidden!
  161.     Static LastState
  162.     If LastState = MAXIMIZED Then
  163.         mdiEnforceHidden
  164.     End If
  165.     LastState = WindowState
  166.  
  167.   'Resize graphic background to fit new dimensions
  168.     Select Case Val(HiddenSwitch)
  169.       Case bkStrWmf 'Use next line for scaled WMF
  170.         Image1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  171.   
  172.       Case bkCenBmp 'Use next line for fixed size BMP
  173.         Image2.Move (Me.ScaleWidth - Image2.Width) \ 2, (Me.ScaleHeight - Image2.Height) \ 2
  174.   
  175.       Case bkStrBmp 'Use next lines for scaled BMP
  176.         StretchImageToForm Image3, Me
  177.  
  178.       Case bkTilBmp
  179.         'Actually, it takes care of itself with the Paint event
  180.  
  181.     End Select
  182.   
  183. End Sub
  184.  
  185. Sub HiddenSwitch_Change ()
  186.  
  187.   'Determine which background to display
  188.     Dim NewImage%
  189.     NewImage = Val(HiddenSwitch)
  190.  
  191.   'Roll back to beginning if we've exceeded the number available
  192.     If NewImage > bkOptions Then
  193.       HiddenSwitch = 0
  194.       Exit Sub 'prevent endless recursion
  195.     End If
  196.  
  197.   'Hide label and force new background to right size
  198.     Expl.Visible = False
  199.     Form_Resize
  200.  
  201.   'Reset properties appropriate to new background
  202.     Select Case NewImage
  203.       Case bkNull 'Currently Picture1 (Tiled BitBlt) switch to [None]
  204.         Cls
  205.         Expl = "No visible background"
  206.         Expl.ForeColor = RGB(0, 0, 0)
  207.   
  208.       Case bkStrWmf 'Currently none switch to Image1 (NoIBM.WMF)
  209.         Me.BackColor = RGB(0, 0, 255)
  210.         Image1.ZOrder 0
  211.         Image1.Visible = True
  212.         Expl = "Strechable WMF"
  213.         Expl.ForeColor = RGB(255, 255, 255)
  214.   
  215.       Case bkCenBmp 'Currently Image1 switch to Image2 (ECLPS4.BMP)
  216.         Image1.Visible = False
  217.         Me.BackColor = RGB(0, 0, 0)
  218.         Image2.ZOrder 0
  219.         Image2.Visible = True
  220.         Expl = "Centered BMP"
  221.         Expl.ForeColor = RGB(255, 255, 0)
  222.   
  223.       Case bkStrBmp 'Currently Image2 switch to Image3 (BONES.BMP)
  224.         Image2.Visible = False
  225.         Me.BackColor = APPLICATION_WORKSPACE
  226.         Image3.ZOrder 0
  227.         Image3.Visible = True
  228.         Expl = "Strechable BMP"
  229.         Expl.ForeColor = RGB(0, 0, 0)
  230.         
  231.       Case bkTilBmp 'Currently Image3 switch to Picture1 (FLOCK.BMP)
  232.         Image3.Visible = False
  233.         Expl = "Tiled BitBlt"
  234.         Expl.ForeColor = RGB(255, 255, 255)
  235.         Me.Refresh 'Needs to be called to invalidate entire rect?
  236.  
  237.     End Select
  238.  
  239.   'Force label to top and make it visible again
  240.     Expl.ZOrder 0
  241.     Expl.Visible = True
  242.  
  243. End Sub
  244.  
  245.